package com.simpleim.starter;

import com.simpleim.starter.client.CommandController;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.context.ApplicationContext;

@SpringBootApplication(scanBasePackages = "com.simpleim.starter")
public class SimpleClientApplication {
    public static void main(String[] args) {
        ApplicationContext applicationContext = SpringApplication.run(SimpleClientApplication.class, args);

        // 启动聊天
        connectServer(applicationContext);
    }

    private static void connectServer(ApplicationContext applicationContext) {
        CommandController controller = applicationContext.getBean(CommandController.class);
        // 初始化命令
        controller.initCommands();
        // 连接服务器
        controller.commandThreadRunning();
    }
}
